from datetime import datetime

from dateutil import tz

import time



if __name__ == '__main__':
    # use timezone
    tz_dubai = tz.gettz('Asia/Dubai')
    tz_sh = tz.gettz('Asia/Shanghai')
    tz_ny = tz.gettz('America/New_York')
    

    # Shanghai timezone
    now_sh = datetime.now(tz=tz_sh)
    print(now_sh)
    # Dubai timezone
    now_dubai = datetime.now(tz=tz_dubai)
    print(now_dubai) 
    # datetime timezone conversion
    print(now_dubai.astimezone(tz_ny)) 
    print('done!') 

    timestamp = time.time()
    datetime_1 = datetime.fromtimestamp(timestamp,tz_sh)
    print(datetime_1.astimezone(tz_sh)) 
